#ifndef SERVICE_EVENTSERVICE_H
#define SERVICE_EVENTSERVICE_H

#include <QObject>
#include <QList>


class AbstractParser;
class AbstractEvent;

namespace Service {

class EventService : public QObject
{
    Q_OBJECT
public:
    typedef QList<AbstractParser *> ParserList;

public:
    explicit EventService(QObject *parent = 0);
    
private:
    static EventService *m_instance;

private:
    ParserList m_parserList;

private:
    void init();
    void setConnection() const;
    AbstractEvent *parseEvent(const QString &commandId, const QVariant &data);
    void deleteParserList();

private slots:
    void onReceived(const QString &commandId, const QVariant &data);

public:
    static EventService *instance(QObject *parent = 0);

public:
    void registerParser(AbstractParser *parser);
    void unregisterParser(AbstractParser *parser);
    
};

} // namespace Service

#endif // SERVICE_EVENTSERVICE_H
